RtOpenSharedMemory

RtOpenSharedMemory opens a named physical-mapping object.

Syntax

HANDLE RtOpenSharedMemory(
    DWORD dwDesiredAccess,
    BOOL bInheritHandle,
    LPCTSTR lpName,
    VOID ** location
);

Parameters

DesiredAccess

The access mode. The RTSS environment always grants read and write access. This parameter can be one of the following values:

Value

Meaning

SHM_MAP_WRITE

Read-write access. The target shared memory object must have been created with PAGE_READWRITE protection. A read-write view of the shared memory is mapped.

SHM_MAP_READ

Read-only access. The target shared memory object must have been created with PAGE_READWRITE or PAGE_READ protection. A read-only view of the shared memory is mapped.

BInheritHandle

Ignored.

lpName

A pointer to a string that names the shared memory object to be opened. Name comparisons are case-sensitive.

location

A pointer to a location where the virtual address of the mapping will be stored.

Return Value

An open handle to the specified shared memory object if the function succeeds, NULL if the function fails

To get extended error information, call GetLastError.

Remarks

The handle that RtOpenSharedMemory returns can be used with RtCloseHandle to decrement the reference count to the shared memory object. When the reference count is zero, the object is removed from the system.

In the same process, different calls to RtOpenSharedMemory may return different locations because they are mapped into different virtual addresses.

Requirements

Minimum Supported Version RTX64 2013
Header Rtapi.h
Library RtApi.lib (Windows), Rtx_Rtss.lib (RTSS)

See Also:

RtCreateSharedMemory

RtCloseHandle